package com.codepilot.server.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import org.springframework.stereotype.Component;

@Component
public class TimeUtil {

    private final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    private final String DATE_FORMAT = "yyyy-MM-dd";

    private DateTimeFormatter datetimeFormatter = DateTimeFormatter.ofPattern(DATETIME_FORMAT);

    private DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(DATE_FORMAT);

    public String getCurrentDatetime() {
        return LocalDateTime.now().format(datetimeFormatter);
    }

    public String getCurrentDate() {
        return LocalDateTime.now().format(dateFormatter);
    }

}
